cmake_minimum_required(VERSION 3.5)

project(test_container VERSION 1.0 LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include_directories(../qtviewer_planetosm)

if (WIN32 AND ${QTV_ACTIVEX})
    find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets AxContainer REQUIRED)
    find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets AxContainer REQUIRED)
else()
    find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED)
    find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)
endif()


set(PRJ_HEADERS
    testcontainer.h
)

set(PRJ_SOURCES
    main.cpp
)

# ========================Exe========================
if (WIN32 AND ${QTV_ACTIVEX})
    add_executable(test_container
	testcontainer.cpp
	testcontainer.ui
	${PRJ_HEADERS}
	${PRJ_SOURCES}
    )
    target_link_libraries(test_container PRIVATE
	Qt${QT_VERSION_MAJOR}::Widgets
	Qt${QT_VERSION_MAJOR}::AxContainer
	qplanetosm_widget
    )
else()
    if(ANDROID)
	add_library(test_container SHARED
	    testcontainer_linux.ui
	    testcontainer_linux.cpp
	    ${PRJ_HEADERS}
	    ${PRJ_SOURCES}
	)
    # Define properties for Android with Qt 5 after find_package() calls as:
    #    set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
    else()
	add_executable(test_container
	    testcontainer_linux.ui
	    testcontainer_linux.cpp
	    ${PRJ_HEADERS}
	    ${PRJ_SOURCES}
	)
    endif()
    target_link_libraries(test_container PRIVATE
	Qt${QT_VERSION_MAJOR}::Widgets
	qplanetosm_widget
    )
endif()

set_target_properties(test_container PROPERTIES
    MACOSX_BUNDLE_GUI_IDENTIFIER qtv.planetosm.testcontainer
    MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
    MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
    MACOSX_BUNDLE TRUE
    WIN32_EXECUTABLE TRUE
)


